home *** CD-ROM | disk | FTP | other *** search
Wrap
public class TrapRegionProjectile extends Codex { private static final int TIMER_ID_INACTIVE = 1; private static final int TIMER_ID_MULTIPLE = 2; private CodexThing _emitter; private String _templateName; private int _numProjectiles; private float _delayBetween; private int _scatter; private float _delayInactive; private boolean bActive; private float[] offset; public static String[] _params = new String[]{"Emitter thing", "Template to fire", "Number of projectiles;1", "Delay in between;0.0", "Scatter;0", "Delay Inactive;5.0"}; public void entered(int guid, int causeGUID, int captureID) { if (!this.bActive) { if (Codex.IsActorGuid(causeGUID)) { this._emitter.FireProjectileAtThing(this._templateName, causeGUID, this.offset); this.bActive = true; ((Codex)this).SetTimer(this._delayInactive, 1); if (this._numProjectiles > 1) { ((Codex)this).SetTimer(this._delayBetween, 2, (float)causeGUID, 1.0F); } } } } public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) { if (timerID == 1) { this.bActive = false; } else { this._emitter.FireProjectileAtThing(this._templateName, (int)arg0, this.offset); if ((int)arg1 + 1 < this._numProjectiles) { ((Codex)this).SetTimer(this._delayBetween, 2, (float)((int)arg0), (float)((int)arg1 + 1)); } } } public TrapRegionProjectile(CodexThing emitter, String templateName, int numProjectiles, float delayBetween, int scatter, float delayInactive) { this._emitter = new CodexThing(((Codex)emitter).GetGUID()); this._templateName = templateName; this._numProjectiles = numProjectiles; this._delayBetween = delayBetween; this._scatter = scatter; this._delayInactive = delayInactive; this.offset = new float[3]; this.offset[0] = 0.0F; this.offset[1] = 0.0F; this.offset[2] = 0.0F; } }